package _02_链表;

/**
 * https://leetcode-cn.com/problems/middle-of-the-linked-list/
 * @Author: haogege
 * @Date: 2021/9/20
 */
public class _876_链表的中间结点1 {

    public ListNode middleNode(ListNode head) {
        ListNode slow = head;
        ListNode fast = head;
        while (fast != null && fast.next != null) {
            slow = slow.next;
            fast = fast.next.next;
        }
        return slow;
    }

}
